package overriden;

public class TestAnimals {
	public static void main (String [] args) {
		Animal a = new Animal();
		Animal b = new Horse();  //Animal ref, but a Horse object
		a.eat(); //runs the Animal version of eat()
		b.eat(); //runs the Horse version of eat()
	}
}

class Animal {
	public void eat() {
		System.out.println("Gneric Animal Eating Generically");
	}
}
class Horse extends Animal {
	public void eat() {
		System.out.println("Horse eating hay, oats, "
							+ "and horse treats");
	}
}